summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGPUCode <geoster3d@gmail.com>2023-06-18 11:27:31 +0200
committerGPUCode <geoster3d@gmail.com>2023-06-18 13:14:03 +0200
commitee0d68300e68a221d9930935f26d0c96be79357b (patch)
tree51b931428967ff49f5feb877ee68b718b737e15f
parentrenderer_vulkan: Use VMA for buffers (diff)
downloadyuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar.gz
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar.bz2
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar.lz
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar.xz
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.tar.zst
yuzu-ee0d68300e68a221d9930935f26d0c96be79357b.zip
-rw-r--r--externals/vma/vma.cpp2
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp12
-rw-r--r--src/video_core/vulkan_common/vulkan_memory_allocator.cpp6
3 files changed, 15 insertions, 5 deletions
diff --git a/externals/vma/vma.cpp b/externals/vma/vma.cpp
index 7f7df9cff..ff1acc320 100644
--- a/externals/vma/vma.cpp
+++ b/externals/vma/vma.cpp
@@ -2,4 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#define VMA_IMPLEMENTATION
+#define VMA_STATIC_VULKAN_FUNCTIONS 0
+#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
#include <vk_mem_alloc.h> \ No newline at end of file
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 541f0c1da..94dd1aa14 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -597,18 +597,22 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
graphics_queue = logical.GetQueue(graphics_family);
present_queue = logical.GetQueue(present_family);
- const VmaVulkanFunctions functions = {
- .vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr,
- .vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr,
- };
+ VmaVulkanFunctions functions{};
+ functions.vkGetInstanceProcAddr = dld.vkGetInstanceProcAddr;
+ functions.vkGetDeviceProcAddr = dld.vkGetDeviceProcAddr;
const VmaAllocatorCreateInfo allocator_info = {
.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT,
.physicalDevice = physical,
.device = *logical,
+ .preferredLargeHeapBlockSize = 0,
+ .pAllocationCallbacks = nullptr,
+ .pDeviceMemoryCallbacks = nullptr,
+ .pHeapSizeLimit = nullptr,
.pVulkanFunctions = &functions,
.instance = instance,
.vulkanApiVersion = VK_API_VERSION_1_1,
+ .pTypeExternalMemoryHandleTypes = nullptr,
};
vk::Check(vmaCreateAllocator(&allocator_info, &allocator));
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
index d2e1ef58e..20d36680c 100644
--- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
+++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
@@ -75,7 +75,7 @@ struct Range {
[[nodiscard]] VkMemoryPropertyFlags MemoryUsagePreferedVmaFlags(MemoryUsage usage) {
return usage != MemoryUsage::DeviceLocal ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
- : VkMemoryPropertyFlags{};
+ : VkMemoryPropertyFlagBits{};
}
[[nodiscard]] VmaAllocationCreateFlags MemoryUsageVmaFlags(MemoryUsage usage) {
@@ -239,8 +239,10 @@ vk::Image MemoryAllocator::CreateImage(const VkImageCreateInfo& ci) const {
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
.preferredFlags = 0,
+ .memoryTypeBits = 0,
.pool = VK_NULL_HANDLE,
.pUserData = nullptr,
+ .priority = 0.f,
};
VkImage handle{};
@@ -259,8 +261,10 @@ vk::Buffer MemoryAllocator::CreateBuffer(const VkBufferCreateInfo& ci, MemoryUsa
.usage = MemoryUsageVma(usage),
.requiredFlags = MemoryUsageRequiredVmaFlags(usage),
.preferredFlags = MemoryUsagePreferedVmaFlags(usage),
+ .memoryTypeBits = 0,
.pool = VK_NULL_HANDLE,
.pUserData = nullptr,
+ .priority = 0.f,
};
VkBuffer handle{};